from langchain_community.tools import WikipediaQueryRun
from langchain_community.utilities import WikipediaAPIWrapper

api_wrapper = WikipediaAPIWrapper(top_k_results=5, doc_content_chars_max=20)
tool = WikipediaQueryRun(api_wrapper=api_wrapper)
print(tool.invoke({"query": "langchain"}))

#打印工具属性
print(f"工具名称:{tool.name}")
print(f"工具描述:{tool.description}")
print(f"工具参数:{tool.args}")
print(f"是否直接返回结果:{tool.return_direct}")